/*
 * k.c
 *
 *  Created on: Oct 9, 2025
 *      Author: Administrator
 */
uint8_t  key_Scan(uint8_t mode)
{
	volatile uint8_t keybits=0,key_value=0;
	keybits=READ_KEY_BITS();
	if(keybits)
	{
		HAL_Delay(20);
		keybits=READ_KEY_BITS();
		switch(keybits)
		{
		case 0x8:
			key_value=1;
		break;
		case 0x4:
			key_value=2;
		break;
		case 0x2:
			key_value=3;
		break;
		case 0x1:
			key_value=4;
		break;
		default:
			break;

		}
		if(mode)
		{
			do
			{
				keybits=READ_KEY_BITS();
			}
			while(keybits);



		}

	}
	return key_value;

}
